//
//  LXLoginStyleViewController.m
//  LvXi_newVersion
//
//  Created by 诸葛孔明 on 16/9/5.
//  Copyright © 2016年 SJT. All rights reserved.
//............................................................................................//
//...........................................个人中心-登录方式...........................................//
//............................................................................................//

#import "LXLoginStyleViewController.h"
#import "LXLoginStyleViewCell.h"



static NSString *const LXLoginStyleCellID = @"LXLoginStyleCell";

@interface LXLoginStyleViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,weak) UITableView *tableView;

@end

@implementation LXLoginStyleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setUpTableView];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self setUpNavi];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
}
-(void)setUpNavi{
    [super setUpNavi];
    self.navigationItem.title = @"登录方式";
}

- (void)setUpTableView
{
    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) style:UITableViewStyleGrouped];
    
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:tableView];
    self.tableView = tableView;
    
    [self.tableView registerClass:[LXLoginStyleViewCell class] forCellReuseIdentifier:LXLoginStyleCellID];
}

#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0) return 1;
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        LXLoginStyleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LXLoginStyleCellID];
        cell.nameLabel.text = @"绿稀账号";
        cell.statusLabel.text = @"已绑定";
        cell.statusLabel.textColor = [UIColor lightGrayColor];
        [cell setBackgroundImageViewHeight:50];
        cell.roundStyle = RoundStyleAll;
        cell.enableUnaderLine = NO;
        return cell;
    }else{
        if (indexPath.row == 0) {
            LXLoginStyleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LXLoginStyleCellID];
            cell.nameLabel.text = @"微信";
            cell.statusLabel.text = @"绿稀全球购";
            cell.statusLabel.textColor = LXMainColor;
            [cell setBackgroundImageViewHeight:50];
            cell.roundStyle = RoundStyleTop;
            cell.enableUnaderLine = YES;
            return cell;
        }else if (indexPath.row == 1){
            LXLoginStyleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LXLoginStyleCellID];
            cell.nameLabel.text = @"微博";
            cell.statusLabel.text = @"未绑定";
            [cell setBackgroundImageViewHeight:50];
            cell.roundStyle = RoundStyleNone;
            cell.enableUnaderLine = YES;
            return cell;
        }else if (indexPath.row == 2){
            LXLoginStyleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LXLoginStyleCellID];
            cell.nameLabel.text = @"QQ";
            cell.statusLabel.text = @"未绑定";
            [cell setBackgroundImageViewHeight:50];
            cell.roundStyle = RoundStyleBottom;
            cell.enableUnaderLine = NO;
            return cell;
        }
    }
    
    UITableViewCell *cell = [[UITableViewCell alloc] init];
    cell.textLabel.text = [NSString stringWithFormat:@"%zd",indexPath.row];
    return cell;
}

#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 1;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return @"绑定账号";
    }else{
        return @"第三方绑定";
    }
}

@end
